package cn.gson.work.model.pojos;

import javax.persistence.*;
import java.sql.Time;
import java.util.Objects;

@Entity
public class Record {
    private long rid;
    private Time rbdate;
    private Time rdate;
    private String rstate;
    private Files filesByFid;

    @Id
    @Column(name = "RID")
    public long getRid() {
        return rid;
    }

    public void setRid(long rid) {
        this.rid = rid;
    }

    @Basic
    @Column(name = "RBDATE")
    public Time getRbdate() {
        return rbdate;
    }

    public void setRbdate(Time rbdate) {
        this.rbdate = rbdate;
    }

    @Basic
    @Column(name = "RDATE")
    public Time getRdate() {
        return rdate;
    }

    public void setRdate(Time rdate) {
        this.rdate = rdate;
    }

    @Basic
    @Column(name = "RSTATE")
    public String getRstate() {
        return rstate;
    }

    public void setRstate(String rstate) {
        this.rstate = rstate;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Record record = (Record) o;
        return rid == record.rid &&
                Objects.equals(rbdate, record.rbdate) &&
                Objects.equals(rdate, record.rdate) &&
                Objects.equals(rstate, record.rstate);
    }

    @Override
    public int hashCode() {
        return Objects.hash(rid, rbdate, rdate, rstate);
    }

    @ManyToOne
    @JoinColumn(name = "FID", referencedColumnName = "FID")
    public Files getFilesByFid() {
        return filesByFid;
    }

    public void setFilesByFid(Files filesByFid) {
        this.filesByFid = filesByFid;
    }
}
